package com.bgds.sys;

import com.bgds.sys.task.CronSchedulerJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * @author lj
 */
@SpringBootApplication
@EnableScheduling
@EnableFeignClients
public class BgdsApplication implements CommandLineRunner {

    @Autowired
    public CronSchedulerJob scheduleJobs;

    public static void main(String[] args) {
        SpringApplication.run(BgdsApplication.class, args);
        welcome();
    }

    private static void welcome() {
        System.out.println("\n");
        System.out.println("\t* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
        System.out.println("\t*                                                                   *");
        System.out.println("\t*                     欢迎使用【中冶赛迪钢厂管理系统！】                    *");
        System.out.println("\t*                                                                   *");
        System.out.println("\t* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
        System.out.println("\n");
    }

    @Override
    public void run(String... args) {
        scheduleJobs.broadcast();
        scheduleJobs.startAlarmTask();
        //设备事故不需要了
//        scheduleJobs.refresh();
    }

}
